package com.dly.blog.init;

import com.dly.blog.domain.config.ChatConfig;
import com.dly.blog.domain.enums.ProxyType;
import com.dly.blog.service.ChatConfigService;
import com.dly.blog.service.FreeFrequencyService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RBlockingDeque;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Configuration;

@Configuration
@AllArgsConstructor
@Slf4j
public class ChatGptConfigInit implements CommandLineRunner {

    private final ChatConfigService chatConfigService;

    @Override
    public void run(String... args) throws Exception {
        log.info("预加载配置....");
        ChatConfig config = ChatConfig.builder()
                .baseUrl("https://api.openai.com/v1")
                .key("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")
                .proxyType(ProxyType.PROXY)
                .proxyIp("127.0.0.1")
                .port(7890)
                .build();
        chatConfigService.save(config);
    }

}
